﻿#pragma once

#include "../IModule.h"

#include <map>
#include <shared_mutex>

#ifdef _DEBUG
#include <vector>
#endif  // _DEBUG

namespace antibot_vector {
#ifdef _DEBUG
	template <typename _Ty>
	using vector = ::std::vector<_Ty>; // Convenient debugging
#else	
	template <typename _Ty>
	using vector = ::fast_io::vector<_Ty>; // Faster speed
#endif
}

struct Antibot_struct {
	// ptr
	C_Entity* ent_ptr{};
	// is exists
	bool is_exists{};
	antibot_vector::vector<uint32_t> tick_exists{};
	antibot_vector::vector<uint32_t> vanish_exists{};
	// speed per tick
	antibot_vector::vector<float> speed{};  // getpos - oldpos
	vec3_t lastpos{}; // last getpos
	uint32_t tp_times{};
	// onground check
	bool is_onground{};
	uint32_t numof_onground_change{};
	// Angle with local players
public:
	antibot_vector::vector<vec3_t> angle{};  // Vertical, horizontal, and last move
	// canSee
	antibot_vector::vector<bool> canSee{};
	size_t canSee_time{};
	// Other parameters
	uint32_t inwall_time{};
	uint32_t inInvisible_time{};
	uint32_t InLava_time{};
	uint32_t InWater_time{};
	uint32_t OnFire_time{};
	bool can_show_NameTag{};
};

extern std::shared_mutex botlist_lock;
extern std::map<uint64_t, Antibot_struct> botlist;

extern SettingEnum AntiBotEnum_AntiBotModule;

extern IModule AntiBotModule;

extern bool isBot(C_Entity* ent);